﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;

namespace INF7GEN
{
    [Serializable()]
    public class Action : ISerializable
    {
        public static String[] NumberOfObjects = {
                                     "one",
                                     "two",
                                     "three",
                                     "nothing"
                                 };

        public static String[] Requirenments = {
                                     "",
                                     "touchable",
                                     "visible",
                                     "carried"
                                 };

        public static String[] OptionalLit = {
                                     "",
                                     "and requiring light"
                                 };


        private int chosenNumberOfObjects = 0;
        private int chosenRequirenment = 0;
        private int chosenOptionalLit = 0;
        private String nameOfAction = "";
        private String typeOfObject = "";
        private int id = 0;

        //----------------------------------------------------------->>
        public Action()
        {
        }

        public override string ToString()
        {
            string s = "" + this.id;
            return "id: " + s;
        }

        public Action(SerializationInfo info, StreamingContext ctxt)
        {
            this.ChosenNumberOfObjects = (int)info.GetValue("ACTIONChosenNumberOfObjects", typeof(int));
            this.ChosenRequirenment = (int)info.GetValue("ACTIONChosenRequirenment", typeof(int));
            this.ChosenOptionalLit = (int)info.GetValue("ACTIONChosenOptionalLit", typeof(int));
            this.NameOfAction = (String)info.GetValue("ACTIONNameOfAction", typeof(String));
            this.TypeOfObject = (String)info.GetValue("ACTIONTypeOfObject", typeof(String));
            this.ID = (int)info.GetValue("ACTIONID", typeof(int));
        }

        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("ACTIONChosenNumberOfObjects", this.ChosenNumberOfObjects);
            info.AddValue("ACTIONChosenRequirenment", this.ChosenRequirenment);
            info.AddValue("ACTIONChosenOptionalLit", this.ChosenOptionalLit);
            info.AddValue("ACTIONNameOfAction", this.NameOfAction);
            info.AddValue("ACTIONTypeOfObject", this.TypeOfObject);
            info.AddValue("ACTIONID", this.ID);
        }

        //------------------------------------------------------------>>


        /// <summary>
        /// Action int id
        /// </summary>
        public int ID
        {
            get { return this.id; }
            set { this.id = value; }
        }

        /// <summary>
        /// Number of objects the action effects or requires
        /// </summary>
        public int ChosenNumberOfObjects
        {
            get { return this.chosenNumberOfObjects; }
            set { this.chosenNumberOfObjects = value; }
        }

        /// <summary>
        /// Optional requirenments for objects of action
        /// </summary>
        public int ChosenRequirenment
        {
            get { return this.chosenRequirenment; }
            set { this.chosenRequirenment = value; }
        }


        /// <summary>
        /// If the object must be in a lit environment
        /// </summary>
        public int ChosenOptionalLit
        {
            get { return this.chosenOptionalLit; }
            set { this.chosenOptionalLit = value; }
        }


        /// <summary>
        /// In game name of action
        /// </summary>
        public String NameOfAction
        {
            get { return this.nameOfAction; }
            set { this.nameOfAction = value; }
        }


        /// <summary>
        /// The type of thing this action effects
        /// </summary>
        public String TypeOfObject
        {
            get { return this.typeOfObject; }
            set { this.typeOfObject = value; }
        }



    }
}
